<template>
<!--group_list.wxml-->
<view class="container">
 
    
    <view class="choice_box">
        <!-- <view wx:for="{{requestData}}" wx:for-item="g">
            <navigator wx:for="{{g.prom_goods_item}}"  class="choice_item" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&item_id={{item.item_id}}" wx:key="{{index}}">
              <view class="img-wrap">
                  <image src="{{url}}/api/goods/goodsThumImages?goods_id={{item.goods_id}}&width=400&height=400"></image>
                  <view class="discount">{{g.prom_detail}}</view>
              </view>
              <view class="title">{{item.goods_name}}</view>
              <view class="price">￥{{item.price}}</view>
              <view class="count-down">
                  <view class="tip-count">剩余</view>
                  <view class="tip-count">{{ g.remainTime }}</view>
              </view>
          </navigator>
        </view> -->
        
        <navigator v-for="(item, index) in requestData" :key="index" :url="'/pages/goods/goodsInfo/goodsInfo?goods_id=' + item.goods_id + '&item_id=' + item.item_id">
            <view class="content">
                <image :src="url + '/api/goods/goodsThumImages?goods_id=' + item.goods_id + '&width=400&height=400'"></image>
                <!-- <image src="{{url}}/api/Activity/promote_list?goods_id={{item.goods_id}}&width=400&height=400" style='width:250rpx;height:250rpx;'></image> -->
                <view>
                    <text class="name">{{item.goods_name}}</text>
                    <view class="price">￥{{item.shop_price}}元
                        <!-- <text>已售:{{item.sales_sum+item.virtual_sales_sum}}件</text> -->
                        <text style>{{item.comment_count}}条评价</text>
                    </view>
                </view>
            </view>
        </navigator>

    </view>
    <view class="no-data" v-if="!requestData || requestData.length == 0">
        <image src="/static/images/cart-null.png" class="cart-image"></image>
        <view class="no-data-title">没有找到相关的记录</view>
        <navigator url="/pages/index/index/index" class="lookat"> 去逛逛 </navigator>
    </view>
</view>
</template>

<script>
var app = getApp();
import LoadMore from "../../../utils/LoadMore";
var load = new LoadMore();
var util = require("../../../utils/util.js");
var request = app.globalData.request;

export default {
  data() {
    return {
      url: app.globalData.setting.url,
      resourceUrl: app.globalData.setting.resourceUrl,
      requestData: null,
      tabType: 0,
      goodsCurrentPage: 1,
      timer: null
    };
  },

  components: {},
  props: {},
  onLoad: function (data) {
    this.requestGroupBuy(data.id);
    console.log(666555);
    console.log(this.url);
  },
  methods: {
    // 请求商品数据
    requestGroupBuy: function (id) {
      var that = this;
      request.post('/api/Activity/promote_list', {
        data: {
          id: id
        },
        success: function (res) {
          that.setData({
            requestData: res.data.result
          });
        }
      });
    }
  }
};
</script>
<style>
/* page{
    background-color: #fff;
} */
.container {
    color: #666;
}
.nav-item{
    float: left;
    width: 25%;
    height: 90rpx;
    line-height: 90rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28rpx;
}
.nav-item .ico-dg{
    width: 32rpx;
    height: 18rpx;
    margin-left: 10rpx;
    line-height: 0;
}
.group-purchase{
    width: 100%;
    height: 375rpx;
}
.choice_box{
    background-color: #f0f2f5;
}
.choice_box .choice_item{
    position: relative;
    float: left;
    width: 370rpx;
    margin: 2rpx;
    font-size: 28rpx;
    background-color: #fff;
    box-sizing: border-box;
}
.choice_item .img-wrap{
    position: relative;
    width:370rpx;
    height:370rpx;
    overflow: hidden;
}
.choice_item .img-wrap image{
    width: 100%;
    height: 100%;
}
 .discount{
    position: absolute;
    right: 0;
    top: 0;
    width: auto;
    height: 46rpx;
    line-height: 46rpx;
    text-align: center;
    font-size: 24rpx;
    color: #fff;
    padding: 0px 5rpx;
    background-color: #ff6a00;
}
.choice_item .title{
    margin:16rpx 0 26rpx 0;
    padding: 0 10rpx;
    height: 36rpx;
    line-height: 36rpx;
    color: #333;
    overflow: hidden;
    word-break: break-all;
}
.involved{
    font-size: 22rpx;
    padding:10rpx;
    color: #666;
}
.choice_item .price{
    height: 30rpx;
    line-height: 30rpx;
    padding-bottom:20rpx;
    padding-left:10rpx;
    color: #ff6a00;
    font-size: 24rpx;
}
.count-down{
    position: absolute;
    right: 0;
    bottom: 20rpx;
    font-size: 22rpx;
    color: #666;
}

/* 优化促销活动页 */
.page{
    background:#F2F2F2 !important;
}
.container{
    padding-top: 20rpx;
}
.content{
    width:710rpx;
    margin-left:10rpx;
    display:inline-block;
    background:#fff;
    margin-bottom:20rpx;
}
.content image{
    width:250rpx;
    height:250rpx;    
}
.content>view{
    position:relative;
    width:460rpx;
    height:250rpx;
    float: right;
}
.content .name{
    color: #181818;
    font-size:26rpx;
    margin-top:15rpx;
}
.content .price{
    position:absolute;
    bottom:0;
    color: #ff6a00;
    font-size:24rpx;
    font-weight:600;
    width:460rpx;
}
.content .price text{
    color:#999;
    float:right;
    font-weight:500;
}
</style>